/*
 * Copyright (c) 2006-2022, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-12-28     unknow       copy by STemwin
 */
#ifndef __DRV_TFTLCD_H
#define __DRV_TFTLCD_H
#include <rtthread.h>
#include "rtdevice.h"
#include <drv_common.h>

#define TFTLCD_DIR	1	//0：竖屏  1：横屏  默认竖屏

// TFTLCD地址结构体
typedef struct 
{
    uint16_t CMD;
    uint16_t DATA;
}TFTLCD_TYPE_DEF;

#define LCD_BASE            ((uint32_t)(0x6C000000 | 0x000007FE))
#define TFTLCD              ((TFTLCD_TYPE_DEF *)LCD_BASE)

// TFTLCD重要参数集
typedef struct
{
    uint16_t width;         // LCD 宽度
    uint16_t height;        // LCD 高度
    uint16_t id;            // LCD ID
    uint8_t  dir;           // 横屏还是竖屏控制：0，竖屏；1，横屏。
}_tftlcd_data;
extern _tftlcd_data tftlcd_data;	// 管理LCD重要参数

//画笔颜色
#define WHITE            0xFFFF
#define BLACK            0x0000
#define BLUE             0x001F
#define BRED             0xF81F
#define GRED             0xFFE0
#define GBLUE            0x07FF
#define RED              0xF800
#define MAGENTA          0xF81F
#define GREEN            0x07E0
#define CYAN             0x7FFF
#define YELLOW           0xFFE0
#define BROWN            0xBC40
#define BRRED            0xFC07
#define GRAY             0x8430
#define DARKBLUE         0x01CF
#define LIGHTBLUE        0x7D7C
#define GRAYBLUE         0x5458
#define LIGHTGREEN       0x841F
#define LGRAY            0xC618
#define LGRAYBLUE        0xA651
#define LBBLUE           0x2B12

void lcd_clear(uint16_t color);
void lcd_fill(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, uint16_t color);
void lcd_draw_point(uint16_t x, uint16_t y, uint16_t color);
uint16_t lcd_read_point(uint16_t x, uint16_t y);
void lcd_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
void lcd_draw_retangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
void lcd_draw_circle(uint16_t x, uint16_t y, uint16_t r, uint16_t color);

#endif

